<include file="Common/header" />
<title>会员列表</title>
</head>
<body>
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 会员管理
	<span class="c-gray en">&gt;</span> 会员列表
	<a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
		<i class="Hui-iconfont">&#xe68f;</i>
	</a>
</nav>
<div class="pd-20">
	<div class="panel panel-primary">
		<div class="panel-header">按条件查询</div> 
		<div class="panel-body">
			房间号：<input class="input-text radius" id="roomnumber" name="roomnumber" style="width: 80px; " />
			姓名：<input class="input-text radius" id="member_nick" name="member_nick" style="width: 100px; " />
			合同号：<input class="input-text radius" id="contract" name="contract" style="width: 100px; " />
			状态：
			<span class="select-box radius" style="width: 80px;">
				<select class="select" size="1" name="visible" id="visible">
					<option value="all">全部</option>
					<option value="1">租用</option>
					<option value="2">失效</option>
					<option value="3">未激活</option>
				</select>
			</span>
			开始时间：
			<span class="select-box radius" style="width: 100px;">
				<input type="text" name="btime" id="btime" class="select layer-date radius time" value="" />
			</span>
			结束时间：
			<span class="select-box radius" style="width: 100px;">
				<input type="text" name="etime" id="etime" class="select layer-date radius time" value="" />
			</span>
			<a href="javascript:;" class="btn btn-success radius querys"><i class="Hui-iconfont">&#xe709;</i> 查询</a> 
		</div>
	</div>
</div>

<div class="pd-20">
	<div class="cl pd-5 bg-1 bk-gray"> 
		<span class="l"> 
			<a class="btn btn-primary radius" href="javascript:;" onclick="admin_role_add('会员录入','add.html','1020', '600')"><i class="Hui-iconfont">&#xe600;</i> 会员录入</a>
			<a class="btn btn-danger radius download" href="javascript:;"><i class="Hui-iconfont">&#xe644;</i> 下载合同</a>
		</span>
		<span class="r">
			累计合同：<strong>{$count}</strong> 条
			在租合同：<strong>{$online}</strong> 条
			昨日新增：<strong>{$yearsday}</strong> 条
			今日新增：<strong>{$todayday}</strong> 条
			当前查询：<strong id="queryCount">{$count}</strong> 条
		</span>
	</div>
	<div class="dataTables_wrapper no-footer" id="ajaxDiv">
		<include file="Member/list_table" />
	</div>
</div>

<script type="text/javascript">
	/*管理员-角色-添加*/
	function admin_role_add(title,url,w,h){
		layer_show(title,url,w,h);
	}
	/*管理员-角色-编辑*/
	function admin_role_edit(title,url,id,w,h){
		layer_show(title,url,w,h);
	}
	
	$(document).ready(function(){
		$(".time").on('click', function(){
			laydate({istime: true, format: 'YYYY-MM-DD'});
		});

		//按条件查询
		$(".querys").on('click', function(){
			var load = layer.load(2);
			var where = {};
				where.contract = $("#contract").val();
				where.roomnumber = $("#roomnumber").val();
				where.ajax = 1;
				where.visible = $("#visible").val();
				where.btime = $("#btime").val();
				where.etime = $("#etime").val();
				where.nick = $("#member_nick").val();
				
			$.get('lists.html', where, function(data){
				layer.close(load);
				$("#ajaxDiv").html(data);
			});
		});
		
		$(".download").on('click', function(){
			var count = 0;
			var ids = '';
			$("tr.text-c td input:checkbox").each(function(){
				if($(this).is(":checked")){
					ids += $(this).val()+',';
					count++;
				}
			});
			
			if(count <= 0){
				layer.msg('请选择需要下载的合同', {icon: 5, time: 2000});
				return false;
			}else if(count > 1){
				layer.msg('暂不支持多个合同下载', {icon: 5, time: 2000});
				return false;
			}
			
			location.href = 'download.html?userid='+ ids;
		});
	});
</script>
</body>
</html>